WIP feat(gnoweb): add State Explorer for browsing on-chain realm state#5283
Open
jaekwon wants to merge 5 commits intofeat/jae/json-vm-specs3from
Open
WIP feat(gnoweb): add State Explorer for browsing on-chain realm state#5283jaekwon wants to merge 5 commits intofeat/jae/json-vm-specs3from
jaekwon wants to merge 5 commits intofeat/jae/json-vm-specs3from
Conversation
Collaborator
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):No automated checks match this pull request. ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
The TCP proxy maintained a persistent connection to the node's RPC server. When a PathHandler triggered a node reload (stop + restart), that connection died, causing the query that triggered the reload to silently fail. Replace the TCP-level proxy with an HTTP reverse proxy (httputil.ReverseProxy) so each request gets a fresh connection. The handler runs synchronously before forwarding, so after a reload the request naturally connects to the new node. Disable keep-alive on the transport to prevent stale pooled connections after restarts. Add TestProxyRestart to validate queries succeed across node restarts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add an interactive state explorer to gnoweb that lets users browse on-chain package state as a lazy-loaded tree. Introduces two new VM query endpoints (qpkg_json for package variables, qtype_json for type definitions) alongside the existing qobject_json, all using standard Amino JSON encoding. Includes @gnojs/amino (misc/gnojs), a standalone TypeScript library for decoding Amino JSON into navigable StateNode trees, and wires it into gnoweb's frontend controller for tree rendering with expand/collapse. Also adds documentation for the JSON query API and updates gnodev's proxy interceptor to handle the new endpoints for lazy loading. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use template.JS for NodesJSON to prevent double-encoding in <script> tags - Add grid-column: 1/-1 so state explorer spans the full grid width - Simplify header: remove redundant h1 and pkg path (tab already labels the view) - Add white-space: nowrap on count text Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…OID search Add State as top-level navigation tab alongside Content, Source, and Actions. Restore colorful type annotations by fixing PurgeCSS deep safelist for dynamic b-state-kind-- classes. Move function source links to top-right corner of code boxes. Add OID pattern detection in searchbar for direct object navigation. Match State view spacing/footer behavior with Content view. Add closuretest demo realm for testing closure variable captures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add closure support to the state explorer: detect closures via non-empty Captures array in FuncValue, display captured variables as expandable children with "Captured variables:" label, and use blue color (info) to distinguish closures from regular functions (purple/tip). Add integration tests for state explorer HTTP endpoints (state view, state JSON API for pkg/oid/tid) and decoder tests for funcs, closures, and multi-capture scenarios. Fix existing layout tests to expect the new State tab. Add ADR-003 documenting the state explorer architecture, and update the @gnojs/amino README with closure/captures documentation. Also fix Makefile to track misc/gnojs/src as esbuild dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2bbc595 to
2b0ae08
Compare
Open
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tree
vm/qpkg_json,vm/qobject_json,vm/qtype_json) that export Amino JSON for packagevariables, objects by ObjectID, and types by TypeID
@gnojs/aminoTypeScript library (misc/gnojs/) that decodes Amino JSON wire format into UI-friendlyStateNodetreeslocations, and OID navigation from the searchbar
Architecture
Three layers:
qpkg_json,qobject_json,qtype_jsonreturn raw Amino JSON@gnojs/amino— TypeScript decoder producingStateNodetrees (handles primitives, structs, maps,pointers, refs, closures, heap items, cycles)
code display
See ADR-003 for full design details.
Key files
gno.land/pkg/sdk/vm/keeper.go—QueryPkgJSON,QueryObjectJSON,QueryTypeJSONgno.land/pkg/sdk/vm/handler.go— route registrationgnovm/pkg/gnolang/values_export.go— Amino JSON export for GnoVM valuesmisc/gnojs/src/decode.ts— Amino JSON → StateNode decodergno.land/pkg/gnoweb/handler_http.go—GetStateView,ServeStateJSONgno.land/pkg/gnoweb/frontend/js/controller-state-explorer.ts— tree UI controllerFollow-up PR
Test plan
go test ./gno.land/pkg/sdk/vm/...— keeper and handler tests for all three query endpointsgo test ./gno.land/pkg/gnoweb/...— HTTP handler tests for state view and JSON APInpx tsx misc/gnojs/src/decode.test.ts— TypeScript decoder tests (primitives, structs, maps, pointers,funcs, closures)
gnodev examples/gno.land/r/demo/boards, navigate to State tab, expand objectsr/demo/closuretest🤖 Generated with Claude Code